package com.mes.defece.controller;

import com.mes.defece.service.TestingTemplateService;
import com.mes.pojo.defece.TestingTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 侯伟豪
 * @Company 起点编程
 * @Description
 * @Time 2024/10/18 17:03
 */
@RestController
@CrossOrigin
@RequestMapping("/testingTemplate")
public class TestingTemplateController {
    @Autowired
    private TestingTemplateService testingProjectService;
//    分页查询
    @GetMapping("/selectAll")
    public Object selectAll(TestingTemplate testingTemplate, @RequestParam(defaultValue = "1" ) Integer page, @RequestParam(defaultValue = "10") Integer limit)
    {
        return testingProjectService.selectAll(testingTemplate, page, limit);
    }
//    新增数据
    @PostMapping("/add")
    public Object addTestingTemplate(@RequestBody TestingTemplate testingTemplate) {
        System.out.println("+++=====>>>"+testingTemplate);
        return testingProjectService.addTestingTemplate(testingTemplate);
    }
//    根据id查询检测模版数据
    @GetMapping("/selectById")
    public Object selectById(@RequestParam Long testingTemplateId)
    {
        return testingProjectService.selectById(testingTemplateId);
    }
//    根据id修改检测模版数据
    @PostMapping("/update")
    public Object updateTestingTemplate(@RequestBody TestingTemplate testingTemplate)
    {
        return testingProjectService.updateTestingTemplateById(testingTemplate);
    }
    //    根据id删除数据信息
    @DeleteMapping("/delete")
    public Object deleteTestingTemplate(@RequestParam Long testingTemplateId)
    {
        return testingProjectService.deleteTestingTemplate(testingTemplateId,99);
    }
}